import 'package:yurun_smartmerchants/models/login_entity.dart';

loginEntityFromJson(LoginEntity data, Map<String, dynamic> json) {
	if (json['token'] != null) {
		data.token = json['token']?.toString();
	}
	if (json['lastLoginTime'] != null) {
		data.lastLoginTime = json['lastLoginTime']?.toString();
	}
	if (json['userDto'] != null) {
		data.userDto = json['userDto'];
	}
	if (json['accountDto'] != null) {
		data.accountDto = new LoginAccountDto().fromJson(json['accountDto']);
	}
	if (json['gateDto'] != null) {
		data.gateDto = json['gateDto'];
	}
	if (json['customerId'] != null) {
		data.customerId = json['customerId'];
	}
	if (json['tree'] != null) {
		data.tree = json['tree'];
	}
	if (json['resources'] != null) {
		data.resources = json['resources'];
	}
	if (json['status'] != null) {
		data.status = json['status'];
	}
	return data;
}

Map<String, dynamic> loginEntityToJson(LoginEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['token'] = entity.token;
	data['lastLoginTime'] = entity.lastLoginTime;
	data['userDto'] = entity.userDto;
	if (entity.accountDto != null) {
		data['accountDto'] = entity.accountDto.toJson();
	}
	data['gateDto'] = entity.gateDto;
	data['customerId'] = entity.customerId;
	data['tree'] = entity.tree;
	data['resources'] = entity.resources;
	data['status'] = entity.status;
	return data;
}

loginAccountDtoFromJson(LoginAccountDto data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id']?.toInt();
	}
	if (json['openId'] != null) {
		data.openId = json['openId'];
	}
	if (json['username'] != null) {
		data.username = json['username']?.toString();
	}
	if (json['password'] != null) {
		data.password = json['password']?.toString();
	}
	if (json['url'] != null) {
		data.url = json['url']?.toString();
	}
	if (json['salt'] != null) {
		data.salt = json['salt']?.toString();
	}
	if (json['consumerId'] != null) {
		data.consumerId = json['consumerId']?.toInt();
	}
	if (json['deleted'] != null) {
		data.deleted = json['deleted'];
	}
	if (json['marketId'] != null) {
		data.marketId = json['marketId'];
	}
	if (json['employeeId'] != null) {
		data.employeeId = json['employeeId'];
	}
	return data;
}

Map<String, dynamic> loginAccountDtoToJson(LoginAccountDto entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['openId'] = entity.openId;
	data['username'] = entity.username;
	data['password'] = entity.password;
	data['url'] = entity.url;
	data['salt'] = entity.salt;
	data['consumerId'] = entity.consumerId;
	data['deleted'] = entity.deleted;
	data['marketId'] = entity.marketId;
	data['employeeId'] = entity.employeeId;
	return data;
}